import { Routes, Route } from "react-router-dom";
import "./App.css";
import { routes } from "./router";
import { Suspense } from "react";
import NProgressLoading from "./components/nprogressLoading";


function App() {
  return (
    <Suspense fallback={<NProgressLoading></NProgressLoading>}>
      <Routes>
        {routes.map((v) => {
          return (
            <Route key={v.path} path={v.path} element={v.element}>
              {v.children &&
                v.children.map((v) => {
                  return (
                    <Route key={v.path} path={v.path} element={v.element}>
                      {v.children &&
                        v.children.map((v) => {
                          return (
                            <Route
                              key={v.path}
                              path={v.path}
                              element={v.element}
                            ></Route>
                          );
                        })}
                    </Route>
                  );
                })}
            </Route>
          );
        })}
      </Routes>
    </Suspense>
  );
}

export default App;
